package com.lyc.yuki.module.system.controller;

import com.lyc.yuki.common.result.ResponseResult;
import com.lyc.yuki.module.system.domain.dto.LoginRequestDTO;
import com.lyc.yuki.module.system.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: lyc
 * @Date: 2025/7/7 14:00
 */
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public ResponseResult<String> login(@RequestBody LoginRequestDTO loginRequestDTO) {
        // 生成令牌
        String token = loginService.login(loginRequestDTO);
        return ResponseResult.successWithData(token);
    }
}
